<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>一朵 - 支付完成</title>
  <!-- swiper-2.7css -->
    <link rel="stylesheet" href="__STATIC__/index/js/swiper/idangerous.swiper.css">
  <!-- swiper-2.7js -->
    <script src="__STATIC__/index/js/swiper/idangerous.swiper.min.js"></script>
  <!-- jquery-3.2.1引用 -->
    <script src="__STATIC__/index/js/global/jquery-3.2.1.min.js"></script>
  <!-- 阿里巴巴矢量图库 -->
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_561814_qyaihbkw7dx3whfr.css">
  <!-- 公共头部 脚部 -->
    <link rel="stylesheet" href="__STATIC__/index/css/global/global.css">
  <!-- 超过1200屏幕 -->
    <link rel="stylesheet" media="screen and (min-width: 1200px)" href="__STATIC__/index/css/succeed/succeed1200.css" />
  <!-- 1080-1200 -->
    <link rel="stylesheet" media="screen  and (min-width: 1080px) and (max-width: 1199px) " href="__STATIC__/index/css/succeed/succeed1080.css"
    />
  <!-- 960-1080 -->
    <link rel="stylesheet" media="screen  and (min-width: 960px) and (max-width: 1079px) " href="__STATIC__/index/css/succeed/succeed960.css"
    />
  <!-- 768-959 -->
    <link rel="stylesheet" media="screen  and (min-width: 768px) and (max-width: 959px) " href="__STATIC__/index/css/succeed/succeed768.css"
    />
  <!-- 568-767 -->
    <link rel="stylesheet" media="screen  and (min-width: 568px) and (max-width: 767px) " href="__STATIC__/index/css/succeed/succeed568.css"
    />
  <!-- 375-567 -->
    <link rel="stylesheet" media="screen  and (min-width: 375px) and (max-width: 567px) " href="__STATIC__/index/css/succeed/succeed375.css"
    />
  <!-- 小于375-->
    <link rel="stylesheet" media="screen  and (max-width: 374px) " href="__STATIC__/index/css/succeed/succeed320.css" />
  <!--引入layer-->
    <script src="__STATIC__/layer/layer.js" ></script>
</head>

<body>
    <div class="M">
        <div class="m-header">
            <div>

                <span onclick="go_back()">
                    <span class="iconfont icon-xiangzuo"></span>
                    返回
                </span>
                <span>交易完成</span>
                <span>
                    {if condition="!empty($realname)"}
                        <a href="{:url('User/index')}" class="my" >
                            {$realname}
                        </a>

                    {else /}
                        <a href="{:url('Login/loginin')}">登录</a>
                        <a href="{:url('Login/register')}">注册</a>
                    {/if}

                    <a href="{:url('MyCart/my_cart')}" class="car">
                        <span class="iconfont icon-gouwuche"></span>
                        <span>{$cart_num}</span>
                    </a>
                </span>
            </div>
        </div>
        <div class="m-contnet">
            <div>
                <p>付款成功</p>
                <img src="__STATIC__/index/img/succeed/succeed.png" alt="">
                <p>获得
                    <span>{$point}</span>积分</p>
                <p>
            </div>
            <a href="{:url('User/my_order')}">查看订单</a>
        </div>
      <!-- 移动端优惠券循环开始 -->
        {foreach name="coupon" item="v"}
            {if condition="!in_array($v.id,$my_coupon)"}
            <div class="pc-discounts-esc " id="m_coupon_{$v.id}">
                <div>
                    <img src="{$v.img}" alt="">
                </div>
                <div>
                    <div>
                        <p>
                            <span>￥</span>
                            <span>{$v.reduce}</span>
                        </p>
                    </div>
                    <div>
                        <p>满{$v.morethan}减{$v.reduce}</p>
                        <p>{$v.use_start_time|date="Y-m-d",###}-{$v.use_end_time|date="Y-m-d",###}</p>
                    </div>
                    <div>
                        <span onclick="get_coupon({$v.id})">
                            领取
                        </span>
                    </div>
                </div>
            </div>
            {/if}
        {/foreach}
      <!-- 移动端优惠券循环结束 -->
    </div>
    <div class="PC">
        {include file="public/p_header" /}
        <div class="pc-headline">
            <p>
                <span>
                    <span></span> 选择商品
                </span>
                <span>-------------</span>
                <span>
                    <span></span>确认订单</span>
                <span>-------------</span>
                <span>
                    <span></span>付款</span>
                <span>-------------</span>
                <span class="pc-gaoliang">
                    <span></span>交易完成</span>
            </p>
        </div>
        <div class="pc-content">
            <p>付款成功</p>
            <img src="__STATIC__/index/img/succeed/succeed.png" alt="">
            <p>获得
                <span>{$point}</span>积分</p>
            <p>
                <a href="{:url('User/index')}">查看订单</a>
            </p>
        </div>
        <div class="pc-discounts">
            {foreach name="coupon" item="v"}
                {if condition="!in_array($v.id,$my_coupon)"}
                <div id="p_coupon_{$v.id}">
                    <div>
                        <div style="background-image: url('{$v.img}');">
                            <p>
                                <span>￥</span>
                                <span>{$v.reduce}</span>
                            </p>
                        </div>
                        <div>
                            <p>满{$v.morethan}减{$v.reduce}</p>
                            <p>{$v.use_start_time|date="Y-m-d",###}-{$v.use_end_time|date="Y-m-d",###}</p>
                        </div>
                        <div>
                            <a href="javascript:;" onclick="get_coupon({$v.id});">领取</a>
                        </div>
                    </div>
                </div>
                {/if}
            {/foreach}
        </div>
        {include file="public/p_footer" /}
    </div>

</body>

</html>
<script>
    /**
     * 领取优惠券
     */
    function get_coupon(id){
        var receive_order_id = "{$receive_order_id}";
        $.post("{:url('PayComplete/get_coupon')}",
            {id:id,receive_order_id:receive_order_id},
            function(data){
                if(data.code == 1){
                    layer.msg('领取成功',{icon:1,time:1500,shade: 0.1}, function(index){
                        layer.close(index);
                        $('#m_coupon_'+id).remove();
                        $('#p_coupon_'+id).remove();
                    });
                    return false;
                }else{
                    layer.msg(data.msg,{icon:2,time:1500,shade: 0.1}, function(index){
                        layer.close(index);
                    });
                    return false;
                }
            }
        );
    }
    /**
     * 返回首页
     */
    function go_back(){
        window.location.href="{:url('Index/index')}";
    }
</script>